package com.longge;

/**
 * @program: my-code
 * @description:
 * @author: longge
 * @create: 2021-05-24 01:59
 */
public class DeleteDuplicates {

    public ListNode deleteDuplicates(ListNode head) {
        if (head == null || head.next == null) return head;

        ListNode listNode = deleteDuplicates(head.next);
        if (listNode.val == head.val) {
            head.next = head.next.next;
        }
        return head;
    }
}
